import { ExtractPropTypes } from "vue"
import { KeyboardMode, KeyboardModes } from "./type"

/**
 * props参数
 */
export const numberKeyboardProps = {
  /** 键盘模式 */
  mode: {
    type: String,
    default: (): KeyboardMode => {
      return 'number'
    },
    validator: (value: KeyboardMode) => {
      return KeyboardModes.includes(value)
    }
  },
  /** 显示., 在mode为number时有效 */
  dot: {
    type: Boolean,
    default: true
  },
  /** 打乱顺序 */
  random: {
    type: Boolean,
    default: false
  }
}
export type NumberKeyboardProps = ExtractPropTypes<typeof numberKeyboardProps>

export const numberKeyboardEmits = {
  change: (value: string | number) => typeof value === 'string' || typeof value === 'number',
  backspace: () => true,
  confirm: () => true
}
export type NumberKeyboardEmits = typeof numberKeyboardEmits
